<?php


namespace App\Models\OpenShop\SiteLocation;


use App\Enums\OpenShop\MissionTemplateEnum;
use App\Models\BaseModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopUploadFileResourceModel;
use App\Models\Traits\KfSoftDeletes;
use App\Models\Traits\KfUid;
use DateTimeInterface;

class OpenShopSiteLocationProductAnalysisModel extends BaseModel
{
    use KfUid;
    use KfSoftDeletes;

    protected $table = 'open_shop_site_location_product_analysis';

    protected $fillable = [
        'id',
        'orderNo',
        'siteId',
        'type',
        'productName',
        'hallFoodNumber',
        'hallFoodUnitPrice',
        'elemNumber',
        'elemUnitPrice',
        'meituanNumber',
        'meituanUnitPrice',
        'createdAt',
        'createdByUid',
        'updatedAt',
        'updatedByUid',
    ];

    const TYPE_1 = 1;
    const TYPE_2 = 2;

    const CN_TYPE_1 = 'competingGoods';
    const CN_TYPE_2 = 'complementary';

    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format("Y-m-d H:i:s");
    }

    public function fileRel()
    {
        return $this->hasMany(OpenShopUploadFileResourceModel::class, 'businessId', 'id');
    }
}
